package com.dm.server.MQ;
import com.dm.server.entity.VoucherOrder;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
@Component
public class SpringProducer {
    @Resource
    private RocketMQTemplate rocketMQTemplate;

    public void sendMessage(String topic, VoucherOrder voucherOrder){
        this.rocketMQTemplate.convertAndSend(topic,voucherOrder);
        //rocketMQTemplate.receive(),这个收消息的方法就是拉模式，我们推模式是监听器方法
    }

}
